package testrank.affinity;

import java.io.Serializable;

/**
 * @author Hagai Cibulski
 *
 */
public final class WordPair implements Serializable {

	private static final long serialVersionUID = 1L;

	private String w1;
	
	private String w2;

	public WordPair(String w1, String w2) {
		super();
		this.w1 = w1;
		this.w2 = w2;
	}

	public String getW1() {
		return this.w1;
	}

	public String getW2() {
		return this.w2;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.w1 == null) ? 0 : this.w1.hashCode());
		result = prime * result + ((this.w2 == null) ? 0 : this.w2.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		WordPair other = (WordPair) obj;
		if (this.w1 == null) {
			if (other.w1 != null)
				return false;
		} else if (!this.w1.equals(other.w1))
			return false;
		if (this.w2 == null) {
			if (other.w2 != null)
				return false;
		} else if (!this.w2.equals(other.w2))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "[" + this.w1 + ", " + this.w2 + "]";
	}
}
